﻿using BCEntity.Sim.Admin.AdminPermissionRecord;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace BCData.Sim.Admin.AdminPermissionRecord
{
    /// <summary>
    /// 员工权限记录
    /// </summary>
    public interface IAdminPermissionRecordData
    {
        /// <summary>
        /// 检查员工权限记录是否存在
        /// </summary>
        /// <param name="permissionCode">权限码</param>
        /// <returns></returns>
        Task<bool> CheckExists(string permissionCode);
        /// <summary>
        /// 检查员工权限记录是否存在
        /// </summary>
        /// <param name="adminId">员工Id</param>
        /// <param name="permissionCode">权限码</param>
        /// <returns></returns>
        Task<bool> CheckExists(long adminId, string permissionCode);
        /// <summary>
        /// 获取员工权限记录
        /// </summary>
        /// <param name="adminId">员工Id</param>
        /// <param name="permissionCode">权限码</param
        /// <returns></returns>
        Task<AdminPermissionRecordEntity> GetEntity(long adminId, string permissionCode);
        /// <summary>
        /// 添加员工权限记录
        /// </summary>
        /// <param name="entity">员工权限记录</param>
        /// <returns></returns>
        Task<AdminPermissionRecordEntity> Add(AdminPermissionRecordEntity entity);
        /// <summary>
        /// 修改员工权限记录
        /// </summary>
        /// <param name="entity">员工权限记录</param>
        /// <returns></returns>
        Task<AdminPermissionRecordEntity> Update(AdminPermissionRecordEntity entity);
        /// <summary>
        /// 获取员工权限记录列表
        /// </summary>
        /// <param name="staffOrganizationMappingRecordId">员工角色Id</param>
        /// <returns></returns>
        Task<IEnumerable<AdminPermissionRecordEntity>> GetList(long staffOrganizationMappingRecordId);
        /// <summary>
        /// 获取员工权限记录列表
        /// </summary>
        /// <param name="permissionCode">权限编码</param>
        /// <returns></returns>
        Task<IEnumerable<AdminPermissionRecordEntity>> GetList(string permissionCode);
        /// <summary>
        /// 获取部门权限记录
        /// </summary>
        /// <param name="departmentId">部门Id</param>
        /// <param name="permissionCode">权限码</param
        /// <returns></returns>
        Task<AdminPermissionRecordEntity> GetEntityByDepartmentIdAsync(int departmentId, string permissionCode);
        /// <summary>
        /// 删除部门权限信息
        /// </summary>
        /// <param name="entity">部门权限记录</param>
        /// <returns></returns>
        Task<bool> DeleteDepartmentPermissionAsync(AdminPermissionRecordEntity entity);
        /// <summary>
        /// 清理部门所有权限
        /// </summary>
        /// <param name="departmentId">部门Id</param>
        /// <returns></returns>
        void ClearDepartmentPermissionAsync(int departmentId);
        /// <summary>
        /// 清理部门权限按照权限列表
        /// </summary>
        /// <param name="permissionCodes">权限Code列表</param>
        /// <param name="departmentId">部门Id</param>
        void ClearPermissionAsync(List<string> permissionCodes, int departmentId);
        /// <summary>
        /// 获取部门权限列表
        /// </summary>
        /// <param name="departmentId">部门Id</param>
        /// <returns></returns>
        Task<IEnumerable<AdminPermissionRecordEntity>> GetDepartmentPermissionRecordListAsync(int departmentId);
        /// <summary>
        /// 新增部门权限
        /// </summary>
        /// <param name="entity">权限信息</param>
        /// <returns></returns>
        Task<AdminPermissionRecordEntity> InsertDepartmentPermissionRecordASync(AdminPermissionRecordEntity entity);
        /// <summary>
        /// 检查部门权限记录是否存在
        /// </summary>
        /// <param name="departmentId">部门Id</param>
        /// <param name="permissionCode">权限码</param>
        /// <returns></returns>
        Task<bool> CheckDepartmenntExists(int departmentId, string permissionCode);

        /// <summary>
        /// 修改部门权限记录
        /// </summary>
        /// <param name="entity">部门权限记录</param>
        /// <returns></returns>
        Task<AdminPermissionRecordEntity> UpdateDepartmentPermissionAsync(AdminPermissionRecordEntity entity);
    }
}
